Imports System
Imports System.Collections
Imports ribs.DataAccessLayer

Namespace BusinessLogicLayer
    Public Class LetterSentCollection
        Inherits CollectionBase

        Default Public Property Item(ByVal index As Integer) As LetterSent
            Get
                Return CType(List(index), LetterSent)
            End Get
            Set(ByVal value As LetterSent)
                List(index) = value
            End Set
        End Property

        Public Function Add(ByVal value As LetterSent) As Integer
            Return List.Add(value)
        End Function 'Add


        Public Function IndexOf(ByVal value As LetterSent) As Integer
            Return List.IndexOf(value)
        End Function 'IndexOf


        Public Sub Insert(ByVal index As Integer, ByVal value As LetterSent)
            List.Insert(index, value)
        End Sub 'Insert


        Public Sub Remove(ByVal value As LetterSent)
            List.Remove(value)
        End Sub 'Remove


        Public Function Contains(ByVal value As LetterSent) As Boolean
            ' If value is not of type Project, this will return false.
            Return List.Contains(value)
        End Function 'Contains


        Protected Overrides Sub OnInsert(ByVal index As Integer, ByVal value As Object)
            If Not value.GetType() Is Type.GetType("RIBS.BusinessLogicLayer.LetterSent") Then
                Throw New ArgumentException("value must be of type LetterSent.", "value")
            End If
        End Sub 'OnInsert

        Protected Overrides Sub OnRemove(ByVal index As Integer, ByVal value As Object)
            If Not value.GetType() Is Type.GetType("RIBS.BusinessLogicLayer.LetterSent") Then
                Throw New ArgumentException("value must be of type LetterSent.", "value")
            End If
        End Sub 'OnRemove

        Protected Overrides Sub OnSet(ByVal index As Integer, ByVal oldValue As Object, ByVal newValue As Object)
            If Not newValue.GetType() Is Type.GetType("RIBS.BusinessLogicLayer.LetterSent") Then
                Throw New ArgumentException("newValue must be of type LetterSent.", "newValue")
            End If
        End Sub 'OnSet

        Protected Overrides Sub OnValidate(ByVal value As Object)
            If Not value.GetType() Is Type.GetType("RIBS.BusinessLogicLayer.LetterSent") Then
                Throw New ArgumentException("value must be of type LetterSent.")
            End If
        End Sub 'OnValidate

    End Class

End Namespace

